package com.she.iiicoursecenter.adapter;

import java.util.ArrayList;
import java.util.List;

import ken.app.helper.Helper;

import com.she.iiicoursecenter.R;
import com.she.iiicoursecenter.event.connect.bean.GetMakeBean;
import com.she.iiicoursecenter.view.KenTextView;

import android.content.Context;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

public class Tab3_Adapter extends GeneralAdapter {

	static ArrayList<GetMakeBean> mDataList;
	static Handler mhandler;
	static GenSelectAllListItemView mGenSelectAllView = new GenSelectAllListItemView();

	public Tab3_Adapter(Context context, List<?> dataList) {
		super(context, mGenSelectAllView);
		mDataList = (ArrayList<GetMakeBean>) dataList;
		// mhandler = handler;
		this.setData(mDataList);
	}

	public static class GenSelectAllListItemView extends GenView {
		LayoutInflater inflater;

		@Override
		protected View genBody(Context context, View convertView, final Object element, final int position) {

			if (inflater == null) {
				inflater = LayoutInflater.from(context);
			}
			final ViewHolder holder;
			if (convertView != null && convertView.getTag() instanceof ViewHolder) {
				holder = (ViewHolder) convertView.getTag();
			} else {
				convertView = inflater.inflate(R.layout.tab3_raw, null);
				holder = new ViewHolder();
				holder.status = (TextView) convertView.findViewById(R.id.tab3_raw_status);
				holder.classId = (KenTextView) convertView.findViewById(R.id.tab3_raw_classid);
				holder.classId2 = (KenTextView) convertView.findViewById(R.id.tab3_raw_classid2);
				holder.date = (TextView) convertView.findViewById(R.id.tab3_raw_date);
				convertView.setTag(holder);
			}

			holder.status.setText(((GetMakeBean) element).getStatus());
			holder.date.setText(Helper.timestampToDate(((GetMakeBean) element).getTimeMake(),"yyyy/MM/dd"));
			holder.classId.setKenText(/*((GetMakeBean) element).getContentCode() + "-" + */((GetMakeBean) element).getContentName());
			holder.classId2.setKenText(((GetMakeBean) element).getItemName());
			
			return convertView;
		}

		private class ViewHolder {
			TextView status,date;
			KenTextView classId,classId2;
		}
	}

}
